<template>
  <div class="Music">
    <h2>{{ musiclist }}</h2>
    <audio v-if="state" class="music" :src="musiclist" controls autoplay>
      你好！
    </audio>
  </div>
</template>

<script>
import Bus from "../../Bus";
export default {
  name: "music",
  data() {
    return {
      musiclist: "",
      state: false,
    };
  },

  created() {
    console.log(this.musiclist);
  },
  // 在mounted钩子里面就开始定阅myMsg主题的消息
  mounted() {
    Bus.$on("Sendmusic", (Sendmusic) => {
      console.log("dome02组件收到bus消息：", Sendmusic);
      this.musiclist = Sendmusic;
      this.state = true;
    });
  },
};
</script>

<style scoped>
.music {
  position: fixed;
  bottom: 0px;
  width: 100%;
}
</style>
